<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--Rendered using the Haskell Html Library v0.2-->
<HTML
><HEAD
><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"
><TITLE
>Main</TITLE
><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"
><SCRIPT SRC="haddock.js" TYPE="text/javascript"
></SCRIPT
></HEAD
><BODY
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="topbar"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD
><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "
></TD
><TD CLASS="title"
></TD
><TD CLASS="topbut"
><A HREF="index.html"
>Contents</A
></TD
><TD CLASS="topbut"
><A HREF="doc-index.html"
>Index</A
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="modulebar"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD
><FONT SIZE="6"
>Main</FONT
></TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Description</TD
></TR
><TR
><TD CLASS="doc"
>Main loop for the game.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Synopsis</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="body"
><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
><TR
><TD CLASS="decl"
><SPAN CLASS="keyword"
>type</SPAN
> <A HREF="#t%3APokerState"
>PokerState</A
> a = StateT <A HREF="Poker.html#t%3AGameState"
>GameState</A
> IO a</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Adeal"
>deal</A
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> ()</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Aante"
>ante</A
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> ()</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AbettingRound"
>bettingRound</A
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> ()</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AdiscardRound"
>discardRound</A
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> ()</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3ApromptUser"
>promptUser</A
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> <A HREF="Poker.html#t%3AAction"
>Action</A
></TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AcurrentPlayer"
>currentPlayer</A
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> <A HREF="Player.html#t%3AT"
>T</A
></TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Aplayers"
>players</A
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> [<A HREF="Player.html#t%3AT"
>T</A
>]</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AgamePhase"
>gamePhase</A
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> <A HREF="Poker.html#t%3AGamePhase"
>GamePhase</A
></TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AactivePlayers"
>activePlayers</A
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> Int</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AleavingDraw"
>leavingDraw</A
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> ()</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AvalidateAction"
>validateAction</A
> :: <A HREF="Poker.html#t%3AAction"
>Action</A
> -&gt; <A HREF="Main.html#t%3APokerState"
>PokerState</A
> (Maybe String)</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AperformAction"
>performAction</A
> :: <A HREF="Poker.html#t%3AAction"
>Action</A
> -&gt; <A HREF="Main.html#t%3APokerState"
>PokerState</A
> ()</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3ApickWinner"
>pickWinner</A
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> ()</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3Areset"
>reset</A
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> ()</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AprintInfo"
>printInfo</A
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> ()</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AprintState"
>printState</A
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> ()</TD
></TR
><TR
><TD CLASS="s8"
></TD
></TR
><TR
><TD CLASS="decl"
><A HREF="#v%3AgameLoop"
>gameLoop</A
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> ()</TD
></TR
></TABLE
></TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="section1"
>Documentation</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><SPAN CLASS="keyword"
>type</SPAN
> <A NAME="t%3APokerState"
></A
><B
>PokerState</B
> a = StateT <A HREF="Poker.html#t%3AGameState"
>GameState</A
> IO a</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3Adeal"
></A
><B
>deal</B
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> ()</TD
></TR
><TR
><TD CLASS="doc"
>Deals to players and saves the state
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3Aante"
></A
><B
>ante</B
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> ()</TD
></TR
><TR
><TD CLASS="doc"
>Subtracts the ante amount from each player and save the state
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3AbettingRound"
></A
><B
>bettingRound</B
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> ()</TD
></TR
><TR
><TD CLASS="doc"
>Starts in a pre-bet state and loops through the players until someone
  calls.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3AdiscardRound"
></A
><B
>discardRound</B
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> ()</TD
></TR
><TR
><TD CLASS="doc"
>Cycles through all players allowing them to discard.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3ApromptUser"
></A
><B
>promptUser</B
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> <A HREF="Poker.html#t%3AAction"
>Action</A
></TD
></TR
><TR
><TD CLASS="doc"
>Handle the non-GameState related results from promptUser.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3AcurrentPlayer"
></A
><B
>currentPlayer</B
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> <A HREF="Player.html#t%3AT"
>T</A
></TD
></TR
><TR
><TD CLASS="doc"
>Get the current player out of the state.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3Aplayers"
></A
><B
>players</B
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> [<A HREF="Player.html#t%3AT"
>T</A
>]</TD
></TR
><TR
><TD CLASS="doc"
>Get all the players out of the state.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3AgamePhase"
></A
><B
>gamePhase</B
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> <A HREF="Poker.html#t%3AGamePhase"
>GamePhase</A
></TD
></TR
><TR
><TD CLASS="doc"
>Get the current game phase out of the state.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3AactivePlayers"
></A
><B
>activePlayers</B
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> Int</TD
></TR
><TR
><TD CLASS="doc"
>Get the number of active players (haven't folded).
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3AleavingDraw"
></A
><B
>leavingDraw</B
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> ()</TD
></TR
><TR
><TD CLASS="doc"
>Set the current game phase.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3AvalidateAction"
></A
><B
>validateAction</B
> :: <A HREF="Poker.html#t%3AAction"
>Action</A
> -&gt; <A HREF="Main.html#t%3APokerState"
>PokerState</A
> (Maybe String)</TD
></TR
><TR
><TD CLASS="doc"
>Validate an action in the current game state.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3AperformAction"
></A
><B
>performAction</B
> :: <A HREF="Poker.html#t%3AAction"
>Action</A
> -&gt; <A HREF="Main.html#t%3APokerState"
>PokerState</A
> ()</TD
></TR
><TR
><TD CLASS="doc"
>Perform an action on the current game state.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3ApickWinner"
></A
><B
>pickWinner</B
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> ()</TD
></TR
><TR
><TD CLASS="doc"
>Pick the winner of the current round.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3Areset"
></A
><B
>reset</B
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> ()</TD
></TR
><TR
><TD CLASS="doc"
>Reset all the players for the next round.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3AprintInfo"
></A
><B
>printInfo</B
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> ()</TD
></TR
><TR
><TD CLASS="doc"
>Show information for the player about the current state of the game.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3AprintState"
></A
><B
>printState</B
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> ()</TD
></TR
><TR
><TD CLASS="doc"
>Print out all the state, it's ugly, but good for debugging.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="decl"
><A NAME="v%3AgameLoop"
></A
><B
>gameLoop</B
> :: <A HREF="Main.html#t%3APokerState"
>PokerState</A
> ()</TD
></TR
><TR
><TD CLASS="doc"
>Plays rounds of poker until exited.
</TD
></TR
><TR
><TD CLASS="s15"
></TD
></TR
><TR
><TD CLASS="botbar"
>Produced by <A HREF="http://www.haskell.org/haddock/"
>Haddock</A
> version 0.8</TD
></TR
></TABLE
></BODY
></HTML
>
